package com.jojocalendar;

import java.util.Calendar;

import com.example.jojocalendar.R;

import android.os.Bundle;
import android.R.integer;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		Calendar calendar = Calendar.getInstance();         
		int year  = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH);
        int date  = calendar.get(Calendar.DATE);    
        
        String[] strThings = getResources().getStringArray(R.array.thingArray);
        TextView textView = (TextView)findViewById(R.id.TextView01);
        
        textView.setText("");
        for(date = 1; date <= 31; date++) {
	        int[] idx = CalendarRandom.next(year, month, date);
	        String strDisplay = String.format("%1$d,%2$d,%3$d,%4$d,%5$d\n", idx[0]%strThings.length,
	        		idx[1]%strThings.length,
	        		idx[2]%strThings.length,
	        		idx[3]%strThings.length,
	        		idx[4]%strThings.length);
	        textView.append(strDisplay);
        }
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
